unit uThreadTester;

interface

uses
  System.Classes, uTesterTools, qworker, qmsgpack, uMsgPackObject, Windows;


type
  TThreadTester = class(TThread)
  private
    FTester: TTesterObject;
  public
    constructor Create(CreateSuspended: Boolean; ATester: TTesterObject); overload;
    procedure Execute;override;
  end;

implementation



constructor TThreadTester.Create(CreateSuspended: Boolean; ATester:
    TTesterObject);
begin
  inherited Create(CreateSuspended);
  FTester := ATester;
end;

{ TThreadTester }

procedure TThreadTester.Execute;
var
  lvObject:TMsgPackObject;
begin
  InterlockedIncrement(__threadcount);
  try
    while not Terminated do
    begin
      FTester.doWorker;
      Sleep(1);
    end;
  finally
    InterlockedDecrement(__threadcount);
  end;
end;

end.
